import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

Vue.use(ElementUI)

Vue.prototype.$del_button = function (callback) {
    this.$confirm('请确认是否删除', '确认信息', {
        distinguishCancelAndClose: true,
        confirmButtonText: '确定',
        cancelButtonText: '取消'
    })
        .then(() => {
            callback()
            this.$message({
                type: 'info',
                message: '删除成功'
            });
        })
        .catch(action => {
            this.$message({
                type: 'info',
                message: action === 'cancel'
                    ? '放弃保存并离开页面'
                    : '停留在当前页面'
            })
        });
}